package com.fanbuchi.fukua.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.fanbuchi.fukua.R;
import com.fanbuchi.fukua.activity.HomeActivity;

import com.fanbuchi.fukua.activity.LoginActivity;
import com.fanbuchi.fukua.activity.RegActivity;
import com.fanbuchi.fukua.activity.base.BaseFragment;
import com.fanbuchi.fukua.manager.OauthManager;

import org.androidannotations.annotations.Click;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by rabbit on 2015/5/30.
 */
public class StartedUpFragmentSingle extends BaseFragment {

    @InjectView(R.id.content)
    TextView content;
    @InjectView(R.id.author)
    TextView author;
    @InjectView(R.id.startApp)
    TextView startApp;

    /* 设置 ，调色板的颜色，让用户选中的颜色可以很好的搭配

    Palette.generateAsync(bmp, new Palette.PaletteAsyncListener() {
        @Override
        public void onGenerated(Palette palette) {
            Palette.Swatch swatch = palette.getVibrantSwatch();
            if(null != swatch) {
                mTextView.setBackgroundColor(swatch.getRgb());
                mTextView.setTextColor(swatch.getTitleTextColor());
            }
        }
    });
    */
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onStart() {
        super.onStart();
    }


    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
    }


    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_started_up, container, false);
        ButterKnife.inject(this, rootView);
        return rootView;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }

    @OnClick(R.id.startApp)
    public void startAppClick(){
        if (OauthManager.getOauthEntity()!=null){
            startActivity(HomeActivity.class);
        }else {
            startActivity(LoginActivity.class);
        }
        getActivity().finish();
    }
}
